结构体数组
视频锁定
{$ currentTime | date:'mm:ss' $}
{$ timeLeft | date:'mm:ss' $}
当我们有很多个结构体变量时,我们可以使用结构体数组,比如我们有3首歌的时候:
struct song song[3] =
{{"红豆","王菲",180,{2013,03,26}},
{"我的歌声里","曲婉婷",180,{2013,03,26}},
{"因为爱情","王菲",180,{2013,03,26}}};
或者
struct song {
char title[64];
char artist[32];
int time;
struct date published;
} songs[3] =
{{"红豆","王菲",180,{2013,03,26}},
{"我的歌声里","曲婉婷",180,{2013,03,26}},
{"因为爱情","王菲",180,{2013,03,26}}};
当然我们也可以先定义结构体数组,然后再对它们进行赋值,赋值的方法和上一个练习中讲的一样。
在线练习
{$ activeFileHint $}